package com.kbbywyclient.util;

import android.content.Context;
import android.os.Handler;
import android.webkit.JavascriptInterface;

import com.kbbywyclient.data.entity.Event;

import org.greenrobot.eventbus.EventBus;

/**
 * Description:
 * Date: 2017/4/18
 * Created by Heaven
 */
public class JSInterface {

    private Context context;
    private Handler mHandler = new Handler();

    public JSInterface(Context context) {
        this.context = context;
    }

    @JavascriptInterface
    public void openDesAndroid(String data) {
        mHandler.post(() -> {
            EventBus.getDefault().post(new Event.UpdateCustomerTableDetail());
        });
    }

    @JavascriptInterface
    public void hid(String data) {
        mHandler.post(() -> {
            EventBus.getDefault().post(new Event.UpdateDiscount());
        });
    }
    @JavascriptInterface
    public void telsAndroid(String data) {
        mHandler.post(() -> {
            EventBus.getDefault().post(new Event.DetailMobile());
        });
    }
}
